package Utility
{
		
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.http.mxml.HTTPService;
	
	
	
	public class HTTPHepler
	{
		public function HTTPHepler()
		{
		}
		
		public static function invokeWebservice(phpFile:String, successHandler:Function, failHandler:Function, parms:Object, resultFormat:String="object"):void
		{
			var httpService : HTTPService = new HTTPService();
			var url : String = "http://localhost/Areej/libraries/";
			url+=phpFile;
			httpService.url = url;
			httpService.useProxy = false;
			httpService.resultFormat = resultFormat;
			httpService.method = "POST";
			httpService.showBusyCursor = true;
			httpService.request = parms;
			httpService.headers["Pragma"] = "no-cache";  // no caching of the file
		    httpService.headers["Cache-Control"] = "no-cache";
			httpService.addEventListener(ResultEvent.RESULT, successHandler);
			httpService.addEventListener(FaultEvent.FAULT, failHandler);
			httpService.send();
			
		}

	}
}